import java.util.*;

public class _2023_10_20 {
    private static boolean check(int n){
        int tmp = (int)Math.sqrt(n);
        int sum = 1;
        for(int i = 2; i < Math.sqrt(n); i++){
            if(n % i == 0) {
                sum += i;
                sum += n / i;
            }
        }
        if(tmp * tmp == n){
            sum += 2 * tmp;
        }
        return sum == n;
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int ret = 0;
        for(int i = 1; i <= num; i++){
            if(check(i)){
                ret++;
            }
        }
        System.out.println(ret);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str  = sc.nextLine();
        int[] arr1 = new int[20];
        int[] arr2 = new int[20];
        int flag = 1;
        char[] s = str.toCharArray();
        for(int i = 0; i < s.length; i++){
            if(s[i] == '-'){
                flag = 2;
            }

            if(s[i] >= '3' && s[i] <= '9'){
                if(flag == 1){
                    arr1[s[i] - '0']++;
                }else{
                    arr2[s[i] - '0']++;
                }
            }

            if(s[i] == '1'){
                i++;
                if(flag == 1){
                    arr1[10]++;
                }else{
                    arr2[10]++;
                }
            }

            if(s[i] == 'J'){
                if(flag == 1){
                    arr1[11]++;
                }else{
                    arr2[11]++;
                }
            }

            if(s[i] == 'Q'){
                if(flag == 1){
                    arr1[12]++;
                }else{
                    arr2[12]++;
                }
            }

            if(s[i] == 'K'){
                if(flag == 1){
                    arr1[13]++;
                }else{
                    arr2[13]++;
                }
            }

            if(s[i] == 'A'){
                if(flag == 1){
                    arr1[14]++;
                }else{
                    arr2[14]++;
                }
            }

            if(s[i] == '2'){
                if(flag == 1){
                    arr1[15]++;
                }else{
                    arr2[15]++;
                }
            }

            if(i + 1 != s.length && s[i] == 'j' && s[i + 1] == 'o'){
                i += 4;
                if(flag == 1){
                    arr1[16]++;
                }else{
                    arr2[16]++;
                }
            }

            if(i + 1 != s.length && s[i] == 'J' && s[i + 1] == 'O'){
                i += 4;
                if(flag == 1){
                    arr1[17]++;
                }else{
                    arr2[17]++;
                }
            }
        }


    }
}
